//
//  UICollectionViewFlowLayout+ZKChain.m
//  ChainFun
//
//  Created by 洪绵卫 on 2022/1/11.
//

#import "UICollectionViewFlowLayout+ZKChain.h"

@implementation UICollectionViewFlowLayout (ZKChain)

+ (UICollectionViewFlowLayout * _Nonnull (^)(void))zk_allocInit{
    return ^(void){
        UICollectionViewFlowLayout * layout = [[UICollectionViewFlowLayout alloc]init];
        return layout;
    };
}

- (UICollectionViewFlowLayout * _Nonnull (^)(CGFloat))zk_minimumLineSpacing{
    return ^(CGFloat value){
        self.minimumLineSpacing = value;
        return self;
    };
}

- (UICollectionViewFlowLayout * _Nonnull (^)(CGFloat))zk_minimumInteritemSpacing{
    return ^(CGFloat value){
        self.minimumInteritemSpacing = value;
        return self;
    };
}
/// item大小
- (UICollectionViewFlowLayout * _Nonnull (^)(CGSize))zk_itemSize{
    return ^(CGSize size){
        self.itemSize = size;
        return self;
    };
}

/// 预估Item的大小
- (UICollectionViewFlowLayout * _Nonnull (^)(CGSize))zk_estimatedItemSize{
    return ^(CGSize size){
        self.estimatedItemSize = size;
        return self;
    };
}

- (UICollectionViewFlowLayout * _Nonnull (^)(UICollectionViewScrollDirection))zk_scrollDirection{
    return ^(UICollectionViewScrollDirection direction){
        self.scrollDirection = direction;
        return self;
    };
}

- (UICollectionViewFlowLayout * _Nonnull (^)(CGSize))zk_headerReferenceSize{
    return ^(CGSize size){
        self.headerReferenceSize = size;
        return self;
    };
}

- (UICollectionViewFlowLayout * _Nonnull (^)(CGSize))zk_footerReferenceSize{
    return ^(CGSize size){
        self.footerReferenceSize = size;
        return self;
    };
}

- (UICollectionViewFlowLayout * _Nonnull (^)(UIEdgeInsets))zk_sectionInset{
    return  ^(UIEdgeInsets offset){
        self.sectionInset = offset;
        return self;
    };
}

- (UICollectionViewFlowLayout * _Nonnull (^)(UICollectionViewFlowLayoutSectionInsetReference))zk_sectionInsetReference API_AVAILABLE(ios(11.0), tvos(11.0)) API_UNAVAILABLE(watchos){
    return ^(UICollectionViewFlowLayoutSectionInsetReference sectionInsetReference){
        self.sectionInsetReference = sectionInsetReference;
        return self;
    };
}

- (UICollectionViewFlowLayout * _Nonnull (^)(BOOL))zk_sectionHeadersPinToVisibleBounds API_AVAILABLE(ios(9.0)){
    return ^(BOOL value){
        self.sectionHeadersPinToVisibleBounds = value;
        return self;
    };
}

- (UICollectionViewFlowLayout * _Nonnull (^)(BOOL))zk_sectionFootersPinToVisibleBounds API_AVAILABLE(ios(9.0)){
    return ^(BOOL value){
        self.sectionFootersPinToVisibleBounds = value;
        return self;
    };
}
@end
